<template>
  <el-card>个人中心</el-card>
  <Swiper autoPlay :duration="3000"></Swiper>
  <TreeTable :columns="columns" :dataSource="treeData"></TreeTable>
</template>

<script setup lang="tsx">
import { postUserInfo, getUserInfo } from "@/api/user";
import TreeTable from "@/components/TreeTable";
const columns = [
  {
    title: "姓名",
    key: "name",
  },
  {
    title: "城市",
    key: "city",
  },
  {
    title: "操作",
    key: "option",
    customRender({ record }) {
      return (
        <button
          class="btn btn-primary"
          onClick={() => console.log(record.name)}
        >
          提示
        </button>
      );
    },
  },
];
const treeData: any[] = [];
for (let i = 0; i < 4; ++i) {
  const level1Data: any[] = [];
  for (let j = 0; j < 10; ++j) {
    const id = `${i}-${j}`;
    level1Data.push({
      id,
      name: `员工${id}`,
      city: "BJ",
    });
  }
  const id = `${i}`;
  treeData.push({
    id,
    name: `员工${id}`,
    city: "BJ",
    children: level1Data,
  });
}

// onMounted(() => {
//   postUserInfo();
//   getUserInfo();
// });
</script>

<style scoped lang="scss"></style>
